<?php
class LoginAction extends BaseAction {
	public function qq(){
		$this->showBrowMes();
	}

	public function weibo(){
		vendor('WeiBo.WeiBo');
		$token = null;
		$o = new SaeTOAuthV2( WB_AKEY , WB_SKEY );
		if (isset($_REQUEST['code'])) {
			$keys = array();
			$keys['code'] = $_REQUEST['code'];
			$keys['redirect_uri'] = WB_CALLBACK_URL;
			try {
				$token = $o->getAccessToken( 'code', $keys ) ;
			} catch (OAuthException $e) {
			}
		}

		if ($token) {
			$_SESSION['token'] = $token;
			setcookie( 'weibojs_'.$o->client_id, http_build_query($token) );
		}
		$this->showBrowMes();
	}

	public function renren(){

	}
	
	public function ajaxLogin(){
	}

	private function showBrowMes(){
		dump($_SESSION);
		dump($_COOKIE);
	}
}
?>